import pytest

def get_student_info(student_id):
    students = {
        1001: {"name": "方鸿新", "age": 21, "sex": "男"},
        1002: {"name": "苏文芷", "age": 21, "sex": "女"},
        1003: {"name": "唐晓芙", "age": 17, "sex": "女"},
        1004: {"name": "赵辛媚", "age": 16, "sex": "女"}
    }
    return students.get(student_id, "The student ID does not exist.")

@pytest.fixture(params=[
    (1001, {"name": "方鸿新", "age": 21, "sex": "男"}),
    (1002, {"name": "苏文芷", "age": 21, "sex": "女"}),
    (1003, {"name": "唐晓芙", "age": 17, "sex": "女"}),
    (1007, "The student ID does not exist.")],
ids=['test_case_1', 'test_case_2', 'test_case_3', 'test_case_4'])
def param_data(request):
    # 返回 request 对象中param，即参数化数据
    return request.param

def test_get_student_info(param_data):
    student_id, expect = param_data
    assert expect == get_student_info(student_id)

if __name__ == '__main__':
    pytest.main(["-v", "pytest_fixture_param_test.py"])
    # -v: verbose模式，显示更详细的测试结果



